export default {
    data() {
        return {
            visibleModal: false,//是否显示隐藏
            titleModal: void 0,//标题
            componentContent: void 0,//内容区组件
            widthModal: 1000,//宽度
            footer: void 0//尾部组件
        }
    },
    methods: {
        handleCloseModal(): void {
            this.visibleModal = false;
            this.componentContent = null;
            this.footer = null;
        },
        initFramFlow() {
            if (!window.FlowOpen) {
                window.FlowOpen = {};
            }
            window.FlowOpen.callback = () => {
                this.handleOpenModal();
                this.handleSearch && this.handleSearch();
            }//全局注册关闭事件
        },
        handleOkModal(){
            this.visibleModal=true;
        },
        handleOpenModal(visible,title,width,componentContent,props,footer){
          this.visibleModal=visible;
          this.titleModal=title;
          this.widthModal=width;
          let defaultProps={
            onCancel:this.handleCloseModal,
            onOk:this.handleOkModal
          };
          let newProps=Object.assign(defaultProps,props);
          this.componentContent=this.$createElement(componentContent,{
            props:newProps
          });
          if(footer){
            this.footer=this.$createElement(footer,{
              props:newProps
            });
          }
        }
    }
}